package com.showsu.editor.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.showsu.editor.dao.TblRemoteInterfaceRecordMapper;
import com.showsu.editor.entity.po.TblRemoteInterfaceRecord;
import com.showsu.editor.service.IRemoteInterfaceRecordService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author: William
 * @Description:
 * @Date: Created in 4:56 下午 2024/1/18
 * @Modified By:
 */
@Service
@Slf4j
public class RemoteInterfaceRecordServiceImpl extends ServiceImpl<TblRemoteInterfaceRecordMapper, TblRemoteInterfaceRecord> implements IRemoteInterfaceRecordService {

    @Autowired
    private TblRemoteInterfaceRecordMapper tblRemoteInterfaceRecordMapper;

    @Override
    public void add(Long interfaceId, Integer success) {
        if (interfaceId == null || success == null) {
            return;
        }
        //这是一个非常基础的方法，它出现异常不能影响上层业务
        try {
            TblRemoteInterfaceRecord entity = new TblRemoteInterfaceRecord();
            entity.setInterfaceId(interfaceId);
            entity.setSuccess(success);
            tblRemoteInterfaceRecordMapper.insert(entity);
        } catch (Exception e) {
            log.error("IRemoteInterfaceRecordService.add(Long, Integer) error", e);
        }
    }
}
